package com.yj.easynavigationbarlibaray;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Sigthp-P-Department on 2018/4/9.
 */

class NavigationController {
    EasyNavigationBar mNavigationBar;

    public NavigationController(EasyNavigationBar easyNavigationBar) {
        this.mNavigationBar=easyNavigationBar;
    }

    public static class NavigationParams {
        public View mView;
        public int mViewLayoutResId=0;
        public Context mContext;
        public ViewHelper viewHelper;
        public ViewGroup mViewGroup;

        public NavigationParams(Context context) {
            this.mContext=context;
        }

        public void apply(){
            //先找布局，如果布局穿的是id，那么带入上下文转出view，如果直接传view就把view传入
            if(mViewLayoutResId!=0){
                viewHelper = new ViewHelper(mContext,mViewLayoutResId,this);
            }

            if(mView!=null){
                viewHelper=new ViewHelper(mView,this);
            }
            if (viewHelper == null){
                try {
                    throw new IllegalAccessException("没有设置一个布局");
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

            viewHelper.addView();
        }


    }
}
